package com.ixuestar.util;

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Reader;
import java.net.HttpURLConnection;
import java.net.ProtocolException;
import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;


import org.apache.commons.lang.ArrayUtils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

/**
 * HTTP工具
 *
 * @author robinzhang
 */
public class HttpUtil {
    /**
     * 请求类型： GET
     */
    public final static String GET = "GET";
    /**
     * 请求类型： POST
     */
    public final static String POST = "POST";
    
    /**
     * 缓冲区大小(缓冲区越大下载的越快,但是要根据自己的服务器配置)  
     */
    private static int BUFFER_SIZE = 10240; 
    /**
     * 模拟Http Get请求
     *
     * @param urlStr   请求路径
     * @param paramMap 请求参数
     * @return
     * @throws Exception
     */
    public static String get(String urlStr, Map<String, String> paramMap) throws Exception {
//        urlStr = urlStr + "?" + getParamString(paramMap);
        HttpURLConnection conn = null;
        try {
            //创建URL对象
            URL url = new URL(urlStr);
            //获取URL连接
            conn = (HttpURLConnection) url.openConnection();
            //设置通用的请求属性
            setHttpUrlConnection(conn, GET);
            //建立实际的连接
            conn.connect();
            //获取响应的内容
            return readResponseContent(conn.getInputStream());
        } finally {
            if (null != conn) conn.disconnect();
        }
    }

    public static void getFile(String urlStr, Map<String, String> paramMap,String filePath) throws Exception {
        urlStr = urlStr + "?" + getParamString(paramMap);
        HttpURLConnection conn = null;
        try {
            //创建URL对象
            URL url = new URL(urlStr);
            //获取URL连接
            conn = (HttpURLConnection) url.openConnection();
            //设置通用的请求属性
            setHttpUrlConnection(conn, GET);
            //建立实际的连接
            conn.connect();
            //获取响应的内容
            readResponseContentFile(conn.getInputStream(),filePath);
        } finally {
            if (null != conn) conn.disconnect();
        }
    }
    
    /**
     * 模拟Http Post请求
     *
     * @param urlStr   请求路径
     * @param paramMap 请求参数
     * @return
     * @throws Exception
     */
    public static String post(String urlStr, Map<String, String> paramMap) throws Exception {
        HttpURLConnection conn = null;
        PrintWriter writer = null;
        try {
            //创建URL对象
            URL url = new URL(urlStr);
            //获取请求参数
            String param = getParamString(paramMap);
            //获取URL连接
            conn = (HttpURLConnection) url.openConnection();
            conn.setRequestProperty("cookie", "c800=dccore0; c800=dccore0; _WorkbenchCross_=Ultraman; JSESSIONID=E313CE4B2E4088956F0E0D56EC0BFB45; yht_username_diwork=ST-14475-aRc03DiqyihYSXOz4D5f-testC2__0a5d3ef7-cce1-4d85-be65-10eabd823a40; yht_usertoken_diwork=vpaVBUFZdD%2Fknw8cgIYzXboKZ3EeSYqH1pCgWh5pOkKJBbRt%2FA1rdwkNE5nv3M1nSHqS0ElXCcrS5whJ%2Bg26FA%3D%3D; yht_access_token=bttNE0wQzZ4YURCV1lZOXBHM2pOT1U3Unh4ODduZXpTSnBVUnZ0UW03UHd4RXRvUHJKYVNNZkc3T3E1Q1hRdTRDWV9fYmlwLXRlc3QueW9ueW91Y2xvdWQuY29t__1bd1883da6131a90e8a1d2fe67ac2d13_1696644778086dccore0iuap-apcom-workbench59913569YT; multilingualFlag=true; timezone=UTC+05:00; language=001; locale=zh_CN; orgId=; defaultOrg=; tenantid=0000L6YQ8AVLFUZPXD0000; theme=; languages=1_3-2_1; newArch=true; sysid=diwork; a00=YpNa6BfFaogQG08AtY1zWeJFa4wZpzrMKyTGdbP_TBQwMDAwTDZZUThBVkxGVVpQWEQwMDAwYDI5MDk5MzA3MTU4NjE1ODRgMDAwMEw2WVE4QVZMRlVaUFhEMDAwMGAwYTVkM2VmNy1jY2UxLTRkODUtYmU2NS0xMGVhYmQ4MjNhNDBgMWBgZTY5OGI1ZTdhN2IwMmQ2YzY5Nzk2Nzc5YGBgMTU0MTk2MjA2NDcyOTczNTE3N2BmYWxzZWBgMTY5NjY0NDc3ODA4MmB5bXNzZXM6YmU5ODczNDQzNzUzOTM4ZDI2N2QwYTVjMTk4ZjU2OTVgZGl3b3JrYA; a10=MDk3NjI3NjIxMjY4MjA3NzgwODM; n_f_f=true; jDiowrkTokenMock=bttNE0wQzZ4YURCV1lZOXBHM2pOT1U3Unh4ODduZXpTSnBVUnZ0UW03UHd4RXRvUHJKYVNNZkc3T3E1Q1hRdTRDWV9fYmlwLXRlc3QueW9ueW91Y2xvdWQuY29t__1bd1883da6131a90e8a1d2fe67ac2d13_1696644778086dccore0iuap-apcom-workbench59913569YT; a10=MDMwMzYyNzI0MjY4MjEzODAzNTI; XSRF-TOKEN=AX_RXRPF9NW9J9TZBT1XNCPQKFRO!102753");
            conn.setRequestProperty("domain-key", "oms");
            //设置通用请求属性
            setHttpUrlConnection(conn, POST);
            //建立实际的连接
            conn.connect();
            //将请求参数写入请求字符流中
            writer = new PrintWriter(conn.getOutputStream());
            writer.print(param);
            writer.flush();
            //读取响应的内容
            return readResponseContent(conn.getInputStream());
        } finally {
            if (null != conn) conn.disconnect();
            if (null != writer) writer.close();
        }
    }

    /**
     * 读取响应字节流并将之转为字符串
     *
     * @param in 要读取的字节流
     * @return
     * @throws IOException
     */
    private static String readResponseContent(InputStream in) throws IOException {
        Reader reader = null;
        StringBuilder content = new StringBuilder();
        try {
            reader = new InputStreamReader(in);
            char[] buffer = new char[1024];
            int head = 0;
            while ((head = reader.read(buffer)) > 0) {
                content.append(new String(buffer, 0, head));
            }
            return content.toString();
        } finally {
            if (null != in) in.close();
            if (null != reader) reader.close();
        }
    }
    
    private static void readResponseContentFile(InputStream in,String filePath) throws IOException {
//    	String filePath = "src/a.pdf";
        Reader reader = null;
        FileOutputStream fos = null;
        byte[] buf = new byte[BUFFER_SIZE];  
        try {
            BufferedInputStream bfInput = new BufferedInputStream(in);
            fos = new FileOutputStream(filePath);
            int size = 0;
            while ((size = bfInput.read(buf)) != -1) {
            	fos.write(buf, 0, size);
            }
        } finally {
            if (null != in) in.close();
            if (null != reader) reader.close();
            fos.close();
        }
    }

    /**
     * 设置Http连接属性
     *
     * @param conn http连接
     * @return
     * @throws ProtocolException
     * @throws Exception
     */
    private static void setHttpUrlConnection(HttpURLConnection conn, String requestMethod) throws ProtocolException {
        conn.setRequestMethod(requestMethod);
        conn.setRequestProperty("domain-key", "oms");
        conn.setRequestProperty("Content-Type", "application/json");
        conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36");
        conn.setRequestProperty("Accept", "*");
        conn.setRequestProperty("Connection", "keep-alive");
        conn.setRequestProperty("yht_access_token", "bttdk4vK2QyUGFadEJvblNBNVhuMWVVRHVwamorSnpzYjVSQk8yS1pGaUhKNHRvUHJKYVNNZkc3T3E1Q1hRdTRDWV9fYmlwLXRlc3QueXl1YXAuY29t__1bd1883da6131a90e8a1d2fe67ac2d13_1681868132163dccore0iuap-apcom-workbench166b7e06YT");
        if (null != requestMethod && POST.equals(requestMethod)) {
            conn.setDoOutput(true);
            conn.setDoInput(true);
        }
    }


    /**
     * 将参数转为路径字符串
     *
     * @param paramMap
     * @return
     */
    private static String getParamString(Map<String, String> paramMap) {
        if (null == paramMap || paramMap.isEmpty()) {
            return "";
        }
        StringBuilder builder = new StringBuilder();
        for (String key : paramMap.keySet()) {
            builder.append("&")
                    .append(key).append("=").append(paramMap.get(key));
        }
        return builder.deleteCharAt(0).toString();
    }

    public static String sendPost(String url, String Params) throws IOException {
        OutputStreamWriter out = null;
        BufferedReader reader = null;
        String response = "";
        try {
            URL httpUrl = null; //HTTP URL类 用这个类来创建连接
            //创建URL
            httpUrl = new URL(url);
            //建立连接
            HttpURLConnection conn = (HttpURLConnection) httpUrl.openConnection();
            conn.setRequestMethod("POST");
            conn.setRequestProperty("Content-Type", "application/json");
            conn.setRequestProperty("connection", "keep-alive");
//            conn.setRequestProperty("Domain-Key", "oms");
            conn.setRequestProperty("yht_access_token", "bttZzlyUWVkeEJmczVSeWlVVUZzNllhTkIwUVNWV3VySTEyQXFOTHlJaE1ab1doY1lpdzNrZ1dGcDB5ZjJUcjNMWF9fZXVjLnlvbnlvdWNsb3VkLmNvbQ..__3e98aab8b3dec7ac12f73da7a47ccfe2_1700043918513dccore3iuap-apcom-workbench612c4112YT");
            conn.setReadTimeout(60*1000);
            conn.setUseCaches(false);//设置不要缓存
            conn.setInstanceFollowRedirects(true);
            conn.setDoOutput(true);
            conn.setDoInput(true);
            conn.connect();
            //POST请求
            out = new OutputStreamWriter(
                    conn.getOutputStream());
            out.write(Params);
            out.flush();
            //读取响应
            reader = new BufferedReader(new InputStreamReader(
                    conn.getInputStream()));
            String lines;
            while ((lines = reader.readLine()) != null) {
                lines = new String(lines.getBytes(), "utf-8");
                response += lines;
            }
            reader.close();
            // 断开连接
            conn.disconnect();
        } catch (Exception e) {
            System.out.println("发送 POST 请求出现异常！" + e);
            e.printStackTrace();
        }
        //使用finally块来关闭输出流、输入流
        finally {
            try {
                if (out != null) {
                    out.close();
                }
                if (reader != null) {
                    reader.close();
                }
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

        return response;
    }
    
    public static String sendPost0(String url, Map<String, String> paramMap) throws IOException {
        OutputStreamWriter out = null;
        BufferedReader reader = null;
        String response = "";
        try {
        	//获取参数
        	String paramString = getParamString(paramMap);
            URL httpUrl = null; //HTTP URL类 用这个类来创建连接
            //创建URL
            httpUrl = new URL(url);
            //建立连接
            HttpURLConnection conn = (HttpURLConnection) httpUrl.openConnection();
            conn.setRequestMethod("POST");
            conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
            conn.setRequestProperty("connection", "keep-alive");
            conn.setReadTimeout(60*1000);
            conn.setUseCaches(false);//设置不要缓存
            conn.setInstanceFollowRedirects(true);
            conn.setDoOutput(true);
            conn.setDoInput(true);
            conn.connect();
            //POST请求
            out = new OutputStreamWriter(
                    conn.getOutputStream());
            out.write(paramString);
            out.flush();
            //读取响应
            reader = new BufferedReader(new InputStreamReader(
                    conn.getInputStream()));
            String lines;
            while ((lines = reader.readLine()) != null) {
                lines = new String(lines.getBytes(), "utf-8");
                response += lines;
            }
            reader.close();
            // 断开连接
            conn.disconnect();
        } catch (Exception e) {
            System.out.println("发送 POST 请求出现异常！" + e);
            e.printStackTrace();
        }
        //使用finally块来关闭输出流、输入流
        finally {
            try {
                if (out != null) {
                    out.close();
                }
                if (reader != null) {
                    reader.close();
                }
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

        return response;
    }
    
//    public static String sendPost1(String url, List<JSONObject> paramMap) throws IOException {
//        OutputStreamWriter out = null;
//        BufferedReader reader = null;
//        String response = "";
//        try {
//        	//获取参数
//        	String paramString = getParamString(paramMap);
//            URL httpUrl = null; //HTTP URL类 用这个类来创建连接
//            //创建URL
//            httpUrl = new URL(url);
//            //建立连接
//            HttpURLConnection conn = (HttpURLConnection) httpUrl.openConnection();
//            conn.setRequestMethod("POST");
//            conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
//            conn.setRequestProperty("connection", "keep-alive");
//            conn.setReadTimeout(60*1000);
//            conn.setUseCaches(false);//设置不要缓存
//            conn.setInstanceFollowRedirects(true);
//            conn.setDoOutput(true);
//            conn.setDoInput(true);
//            conn.connect();
//            //POST请求
//            out = new OutputStreamWriter(
//                    conn.getOutputStream());
//            out.write(paramString);
//            out.flush();
//            //读取响应
//            reader = new BufferedReader(new InputStreamReader(
//                    conn.getInputStream()));
//            String lines;
//            while ((lines = reader.readLine()) != null) {
//                lines = new String(lines.getBytes(), "utf-8");
//                response += lines;
//            }
//            reader.close();
//            // 断开连接
//            conn.disconnect();
//        } catch (Exception e) {
//            System.out.println("发送 POST 请求出现异常！" + e);
//            e.printStackTrace();
//        }
//        //使用finally块来关闭输出流、输入流
//        finally {
//            try {
//                if (out != null) {
//                    out.close();
//                }
//                if (reader != null) {
//                    reader.close();
//                }
//            } catch (IOException ex) {
//                ex.printStackTrace();
//            }
//        }
//
//        return response;
//    }

    public static void sendFilePost(String url, String Params,String filePath) throws IOException {

        OutputStreamWriter out = null;
        FileOutputStream fos = null;  
        try {
            URL httpUrl = null; //HTTP URL类 用这个类来创建连接
            //创建URL
            httpUrl = new URL(url);
            //
            byte[] buf = new byte[BUFFER_SIZE];  
            //建立连接
            HttpURLConnection conn = (HttpURLConnection) httpUrl.openConnection();
            conn.setRequestMethod("POST");
            conn.setRequestProperty("Content-Type", "application/json");
            conn.setRequestProperty("connection", "keep-alive");
            conn.setRequestProperty("Cookie", "c800=dccore0; c800=dccore0; _WorkbenchCross_=Ultraman; PHPSESSID=anoch49o6q71qsopvmd9854ou0; YKJ_IS_DIWORK=1; YKJ_DIWORK_DATA=%7B%22data%22%3A%7B%22is_diwork%22%3A1%2C%22cur_qzid%22%3A%2225285%22%7D%2C%22key%22%3A%222bf44eb818ef9255e84e532ad5a201a8%22%7D; _WorkbenchCross_=Ultraman; multilingualFlag=true; timezone=UTC+08:00; language=001; locale=zh_CN; orgId=; theme=; newArch=true; sysid=diwork; n_f_f=true; Hm_lvt_b97569d26a525941d8d163729d284198=1695353883,1695609274; Hm_lvt_e8002ef3d9e0d8274b5b74cc4a027d08=1695353883,1695609274; JSESSIONID=EE5B8E732C04A4100A0E3CAC962A1E07; yht_username_diwork=ST-7346-5CbCeUmyotrrK1mjD3cV-testC2__99ea7655-00a2-4bda-b23c-19ade37ea574; yht_usertoken_diwork=gw%2BgDqtHu719MsnN3CPwXHLj1XpKfVDaQJSMIxnBYzUuazGlqzfwr7fqLsH3f22lHNq1bQp8NyqISeEKrfvD0Q%3D%3D; yht_access_token=bttS1o1T2x5eUJmTjhyYjZxbU9SREpxQW45clIxZzJwdXZ3eG01L2dwMndZYlZKb0xzeXBEdUtvRGVmbENDVWljaF9fYmlwLXRlc3QueW9ueW91Y2xvdWQuY29t__efe01ac3165cf69d3c729add33bd2680_1695620663844dccore0iuap-apcom-workbench1257a4c4YT; defaultOrg=1530661876902920193; tenantid=0000L6YTYEY5FUZPXE0000; languages=1_3-2_1-3_1-98_1; a00=bZee8efhdxqYH6wWk5arcaAYD7isDKyUnoPkiDfJSOMwMDAwTDZZVFlFWTVGVVpQWEUwMDAwYDI5MTAwMzMxNDY3NjE4MDhgMDAwMEw2WVRZRVk1RlVaUFhFMDAwMGA5OWVhNzY1NS0wMGEyLTRiZGEtYjIzYy0xOWFkZTM3ZWE1NzRgMWBgZTZiNThiZThhZjk1ZTdhZWExZTc5MDg2ZTU5MTk4MzEzMTMxYGBgMTUyNTY5NTQ2MDIxMDYzODg1OGBmYWxzZWBgMTY5NTYyMDY2Mzg0OWB5bXNzZXM6MGUxZGUxZTZlODlhNDQyMThjZTNhZDExOGZkY2ViZGZgZGl3b3JrYA; a10=MDEzNDM5MzI0MjU3OTY2NjM4NTA; Hm_lpvt_b97569d26a525941d8d163729d284198=1695620680; Hm_lpvt_e8002ef3d9e0d8274b5b74cc4a027d08=1695620680; yht_access_token=bttMEpNM2JUREU1TElRbW8wZlpnMXE2eWNIZ0FqU05xbE5DZmZsVTBZNGZsMVpJK1ZkRkZSZW9qRkxIY0pGN0xLU19fYmlwLWRhaWx5LnlvbnlvdWNsb3VkLmNvbQ..__8df4684f554fc93ddc9d4818c03f873e_1695621095236dccore0iuap-apcom-workbench89eb867dYT; multilingualFlag=true; timezone=UTC+08:00; language=001; locale=zh_CN; orgId=; defaultOrg=; tenantid=h6q8321v; theme=; languages=1_3-2_1-3_1; newArch=false; sysid=diwork; a00=7_ecvDzABfEbLnukPgxWrDlEUSNiGZexIg5pqop2XZ9oNnE4MzIxdmAxODU3ODgxMjgwMDU3NjAwYGg2cTgzMjF2YGVjMjQ2ZGFiLTFmZGMtNDhmZC05ZjAxLTFlMGViMGY4YTNjNGAxYGBlNjk4YjVlN2E3YjAyZDUyNTg1NGBgYDI3MjI4MTgxMDc4MTc0NzJgZmFsc2VgYDE2OTU2MjEwOTUyMzlgeW1zc2VzOmU0MjVlM2Q0ZTdkY2FhOWZiNTMyODIxZTlhZDQ3NTljYHU4YzMuMGA; n_f_f=false; wb_at=LMjoosqsvj6misqn8tuNHFOvQZBBjwjbnlahmd; jDiowrkTokenMock=bttMEpNM2JUREU1TElRbW8wZlpnMXE2eWNIZ0FqU05xbE5DZmZsVTBZNGZsMVpJK1ZkRkZSZW9qRkxIY0pGN0xLU19fYmlwLWRhaWx5LnlvbnlvdWNsb3VkLmNvbQ..__8df4684f554fc93ddc9d4818c03f873e_1695621095236dccore0iuap-apcom-workbench89eb867dYT; a10=ODE1MzQyODQ0MjU4MDU0OTQ3MzA; XSRF-TOKEN=FIX_H1B0AJ9JXFDSC2W7HJFK4ULPH!161527");
            conn.setReadTimeout(60*1000);
            conn.setUseCaches(false);//设置不要缓存
            conn.setInstanceFollowRedirects(true);
            conn.setDoOutput(true);
            conn.setDoInput(true);
            conn.connect();
            //POST请求
            out = new OutputStreamWriter(
                    conn.getOutputStream());    		
            out.write(Params);
            out.flush();
            InputStream inputStream = conn.getInputStream();
            //读取响应
            BufferedInputStream bfInput = new BufferedInputStream(inputStream);
            fos = new FileOutputStream(filePath);
            int size = 0;
            while ((size = bfInput.read(buf)) != -1) {
            	fos.write(buf, 0, size);
            }
            // 断开连接
            conn.disconnect();
        } catch (Exception e) {
            System.out.println("发送 POST 请求出现异常！" + e);
            e.printStackTrace();
        }
        //使用finally块来关闭输出流、输入流
        finally {
            try {
                if (out != null) {
                	fos.close();
                    out.close();
                }
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
    }
    
    public static void sendFilePost0(String url, Map<String, String> paramMap,String filePath) throws IOException {

        OutputStreamWriter out = null;
        FileOutputStream fos = null;  
        try {
        	String paramString = getParamString(paramMap);
            URL httpUrl = null; //HTTP URL类 用这个类来创建连接
            //创建URL
            httpUrl = new URL(url);
            //
            byte[] buf = new byte[BUFFER_SIZE];  
            //建立连接
            HttpURLConnection conn = (HttpURLConnection) httpUrl.openConnection();
            conn.setRequestMethod("POST");
            conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            conn.setRequestProperty("connection", "keep-alive");
            conn.setReadTimeout(60*1000);
            conn.setUseCaches(false);//设置不要缓存
            conn.setInstanceFollowRedirects(true);
            conn.setDoOutput(true);
            conn.setDoInput(true);
            conn.connect();
            //POST请求
            out = new OutputStreamWriter(
                    conn.getOutputStream());    		
            out.write(paramString);
            out.flush();
            InputStream inputStream = conn.getInputStream();
            //读取响应
            BufferedInputStream bfInput = new BufferedInputStream(inputStream);
            fos = new FileOutputStream(filePath);
            int size = 0;
            while ((size = bfInput.read(buf)) != -1) {
            	fos.write(buf, 0, size);
            }
            // 断开连接
            conn.disconnect();
        } catch (Exception e) {
            System.out.println("发送 POST 请求出现异常！" + e);
            e.printStackTrace();
        }
        //使用finally块来关闭输出流、输入流
        finally {
            try {
                if (out != null) {
                	fos.close();
                    out.close();
                }
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
    }
    
    public static JSONObject getJSONOBject(JSONObject jsonObject) {

        JSONObject jsObject = null;
        try {

            String s = sendPost("http://luoboshop.com/robo/vendingMachineController/getVendingMachineData", jsonObject.toString());

            jsObject = JSON.parseObject(s);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsObject;
    }
    
    
//    @SuppressWarnings("resource")
//	public static void main(String[] args) {
//    	
//    	
//    	try {
//    		InputStream fileInputStream = new FileInputStream(new File("D:\\Program Files\\Desktop\\responseId.json"));
//			BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(fileInputStream));
//			
//			StringBuffer stringBuffer = new StringBuffer();
//			String lineStringBuffer="";
//			while((lineStringBuffer=bufferedReader.readLine())!=null) {
//				stringBuffer.append(lineStringBuffer);
//			}
//			
//			JSONArray parseArray = JSONArray.parseArray(stringBuffer.toString());
//			for (int i = 0; i < parseArray.size(); i++) {
//				JSONArray jsonArray = parseArray.getJSONArray(i);
//				
//				String urlString = "https://yonsuite.diwork.com/mdf-node/uniform/bill/list?serviceCode=ECInventAllot02&locale=zh_CN&terminalType=1&extend=true";
//				
//				String string = "{\"page\":{\"pageSize\":1000,\"pageIndex\":1},\"billnum\":\"ec_distributionExecutionUnAuto\",\"condition\":{\"commonVOs\":[{\"itemName\":\"schemeName\",\"value1\":\"默认方案\"},{\"itemName\":\"isDefault\",\"value1\":true},{\"value1\":[\"1570021773316980952\",\"1570022237173448884\"],\"itemName\":\"product_sku_id\"},{\"value1\":100,\"itemName\":\"num_scale\"},{\"value1\":\"0\",\"itemName\":\"is_suit\"},{\"value1\":\"1\",\"itemName\":\"is_noStock\"}],\"filtersId\":\"1070097432\",\"solutionId\":1069317605},\"bClick\":true,\"bEmptyWithoutFilterTree\":false,\"serviceCode\":\"ECInventAllot02\",\"locale\":\"zh_CN\",\"isDistinct\":true,\"ownDomain\":\"dst\",\"tplid\":3100360}";
//		    	JSONObject parseObject = JSONObject.parseObject(string);
//		    	JSONArray commonVOs = parseObject.getJSONObject("condition").getJSONArray("commonVOs");
//		    	for (int j = 0; j < commonVOs.size(); j++) {
//		    		JSONObject jsonObject = commonVOs.getJSONObject(j);
//		    		if (jsonObject.getString("itemName").equals("product_sku_id")) {
//						jsonObject.put("value1", jsonArray);
//					}
//				}
//		    	List<String> list = new LinkedList<>();
//		    	JSONArray recordList = JSONObject.parseObject(HttpUtil.sendPost(urlString, parseObject.toJSONString())).getJSONObject("data").getJSONArray("recordList");
//				for (int j = 0; j < recordList.size(); j++) {
//					JSONObject jsonObject = recordList.getJSONObject(j);
//					list.add("\""+jsonObject.getString("id")+"\"");
//					if (list.size()==100 || jsonObject.containsValue("1788356805179473935")) {
//						String urlString2 = "https://yonsuite.diwork.com/mdf-node/uniform/distribution/unAutoUpLoad?action=upload&billnum=ec_distributionExecutionUnAuto&serviceCode=ECInventAllot02&terminalType=1&extend=true&locale=zh_CN";
//						
//						String str = "{\"billnum\":\"ec_distributionExecutionUnAuto\",\"action\":\"upload\",\"data\":\"[\\\"1800186227447562247\\\",\\\"1800186227447562246\\\"]\"}";
//						JSONObject parseObject2 = JSONObject.parseObject(str);
//						parseObject2.put("data", list.toString());
//						
//						String sendPost = HttpUtil.sendPost(urlString2, parseObject2.toJSONString());
//						list = new LinkedList<>();
//						System.out.println(sendPost);
//					}
//				}
//			}
//		} catch (Exception e) {
//			// TODO: handle exception
//		}
    	
    	
    	
    	
    	
    	
//		String goId = "202305281445125181685256312518";
//		String operator = "travelBao";
//		String secretKey = "iskytrip&travelbao";
//    	String goOrderPrintCode = "0528931269";
//    	String goOrderPrintTime = "2023-05-28 14:45:21";
//    	
//    	File file = new File("D:\\Program Files\\Desktop\\sendEvent.txt");
//    	try {
//			InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(file));
//			BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
//			
//			StringBuffer stringBuffer = new StringBuffer();
//			String lineString = "";
//			while ((lineString=bufferedReader.readLine())!=null) {
//				stringBuffer.append(lineString);
//			}
//			
//			List<String> list = new LinkedList<>();
//			JSONObject parseObject = JSONObject.parseObject(stringBuffer.toString());
//			JSONArray jsonArray = parseObject.getJSONObject("data").getJSONArray("content");
//			for (int i = 0; i < jsonArray.size(); i++) {
//				JSONObject jsonObject = jsonArray.getJSONObject(i);
//				list.add(jsonObject.getString("billId"));
//			}
//			System.out.println(list);
//		} catch (FileNotFoundException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		} catch (IOException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
		
//	}
    
    
//    public static void main(String[] args) throws ParseException {
////		String string = "店铺123本次成功下载12条,更新8条！";
////		Date parse = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2023-08-31 00:00:00");
////		System.out.println(parse.compareTo(new Date()));
////		System.out.println(string.substring(string.indexOf("本次成功下载")+6, string.indexOf("条,更")));
//    	String [] arr = {"1","2"};
//    	System.out.println(Arrays.asList(ArrayUtils.remove(arr, 0)));
//    	
//		
//		
//	}
    
//    ["167","277","321","302","205","280","307","281","283"]
    
//    public static void main(String[] args) throws IOException {
//    	
//    	Set<String> hashSet = new HashSet<>();
//    	String [] arr = {"SR153520230823000001","SR153520230823000002","SR153520230823000003","SR153520230823000004","SR153520230823000005","SR153520230823000006","SR153520230823000007","SR153520230823000008","SR153520230823000009","SR153520230823000010","SR153520230823000011","SR153520230823000012","SR153520230823000013","SR153520230823000014","SR153520230823000015","SR153520230823000016","SR153520230823000017","SR153520230823000018","SR153520230823000019","SR153520230823000020","SR153520230823000021","SR153520230823000022","SR153520230823000023","SR153520230823000024","SR153520230823000025","SR153520230823000026","SR153520230823000027","SR153520230823000028","SR153520230823000029","SR153520230823000030","SR153520230823000031","SR153520230823000032","SR153520230823000033","SR153520230823000034","SR153520230823000035","SR153520230823000036","SR153520230823000037","SR153520230823000038","SR153520230823000039","SR153520230823000040","SR153520230823000041","SR153520230823000042","SR153520230823000043","SR153520230823000044","SR153520230823000045","SR153520230823000046","SR153520230823000047","SR153520230823000048","SR153520230823000049","SR153520230823000050","SR153520230823000051","SR153520230823000052","SR153520230823000053","SR153520230823000054","SR153520230823000055","SR153520230823000056","SR153520230823000057","SR153520230823000058","SR153520230823000059","SR153520230823000060","SR153520230823000061","SR153520230823000062","SR153520230823000063","SR153520230823000064","SR153520230823000065","SR153520230823000066","SR153520230823000067","SR153520230823000068","SR153520230823000069","SR153520230823000070","SR153520230823000071","SR153520230823000072","SR153520230823000073","SR153520230823000074","SR153520230823000075","SR153520230823000076","SR153520230823000077","SR153520230823000078","SR153520230823000079","SR153520230823000080","SR153520230823000081","SR153520230823000082","SR153520230823000083","SR153520230823000084","SR153520230823000085","SR153520230823000086","SR153520230823000087","SR153520230823000088","SR153520230823000089","SR153520230823000090","SR153520230823000091","SR153520230823000092","SR153520230823000093","SR153520230823000094","SR153520230823000095","SR153520230823000096","SR153520230823000097","SR153520230823000098","SR153520230823000099","SR153520230823000100","SR153520230823000101","SR153520230823000102","SR153520230823000103","SR153520230823000104","SR153520230823000105","SR153520230823000106","SR153520230823000107","SR153520230823000108","SR153520230823000109","SR153520230823000110","SR153520230823000111","SR153520230823000112","SR153520230823000113","SR153520230823000114","SR153520230823000115","SR153520230823000116","SR153520230823000117","SR153520230823000118","SR153520230823000119","SR158020230823000001","SR158020230823000002","SR158020230823000003","SR158020230823000004","SR158020230823000005","SR158020230823000006","SR158020230823000007","SR158020230823000008","SR162820230823000001","SR162820230823000002","SR162820230823000003","SR162820230823000004","SR162820230823000005","SR162820230823000006","SR162820230823000007","SR162820230823000008","SR162820230823000009","SR162820230823000010","SR162820230823000011","SR162820230823000012","SR162820230823000013","SR162820230823000014","SR162820230823000015","SR162820230823000016","SR162820230823000017","SR162820230823000018","SR162820230823000019","SR162820230823000020","SR162820230823000021","SR163520230823000001","SR163520230823000002","SR163520230823000003","SR163520230823000004","SR163520230823000005","SR163520230823000006","SR163520230823000007","SR163520230823000008","SR163520230823000009","SR163520230823000010","SR163520230823000011","SR163520230823000012","SR163520230823000013","SR163520230823000014","SR163520230823000015","SR163520230823000016","SR163520230823000017","SR163520230823000018","SR163520230823000019","SR163520230823000020","SR163520230823000021","SR163520230823000022","SR163520230823000023","SR163520230823000024","SR163520230823000025","SR163520230823000026","SR163520230823000027","SR163520230823000028","SR163520230823000029","SR163520230823000030","SR163520230823000031","SR163520230823000032","SR163520230823000033","SR163520230823000034","SR163520230823000035","SR163520230823000036","SR163520230823000037","SR163520230823000038","SR163520230823000039","SR163520230823000040","SR163520230823000041","SR163520230823000042","SR163520230823000043","SR163520230823000044","SR163520230823000045","SR163520230823000046","SR163520230823000047","SR163520230823000048","SR163520230823000049","SR163520230823000050","SR163520230823000051","SR163520230823000052","SR163520230823000053","SR163520230823000054","SR163520230823000055","SR163520230823000056","SR163520230823000057","SR163520230823000058","SR163520230823000059","SR163520230823000060","SR163520230823000061","SR163520230823000062","SR163520230823000063","SR163520230823000064","SR163520230823000065","SR163520230823000066","SR163520230823000067","SR163520230823000068","SR163520230823000069","SR163520230823000070","SR163520230823000071","SR163520230823000072","SR163520230823000073","SR163520230823000074","SR163520230823000075","SR163520230823000076","SR163520230823000077","SR163520230823000078","SR163520230823000079","SR163520230823000080","SR163520230823000081","SR163520230823000082","SR163520230823000083","SR163520230823000084","SR163520230823000085","SR163520230823000086","SR163520230823000087","SR163520230823000088","SR163520230823000089","SR163520230823000090","SR163520230823000091","SR163520230823000092","SR163520230823000093","SR163520230823000094","SR163520230823000095","SR163520230823000096","SR163520230823000097","SR163520230823000098","SR163520230823000099","SR163520230823000100","SR163520230823000101","SR163520230823000102","SR163520230823000103","SR163520230823000104","SR163520230823000105","SR163520230823000106","SR163520230823000107","SR163520230823000108","SR163520230823000109","SR165420230823000001","SR165420230823000002","SR165420230823000003","SR165420230823000004","SR165420230823000005","SR165420230823000006","SR165420230823000007","SR165420230823000008","SR165420230823000009","SR165420230823000010","SR167520230824000001","SR167520230824000002","SR167520230824000003","SR167520230824000004","SR167520230824000005","SR167520230824000006","SR167520230824000007","SR167520230824000008","SR167520230824000009","SR167520230824000010","SR167520230824000011","SR169120230823000001","SR169120230823000002","SR170720230823000001","SR170720230823000002","SR170720230823000003","SR170720230823000004","SR172820230823000001","SR172820230823000002","SR172820230823000003","SR172820230823000004","SR172820230823000005","SR172820230823000006","SR175320230823000001","SR175320230823000002","SR175320230823000003","SR176220230823000001","SR176220230823000002","SR176220230823000003","SR177120230824000001","SR177120230824000002","SR177120230824000003","SR177120230824000004","SR177120230824000005","SR177120230824000006","SR177120230824000007","SR177120230824000008","SR177120230824000009","SR177120230824000010","SR177120230824000011","SR178420230823000001","SR178420230823000002","SR178420230823000003","SR178620230823000001","SR178620230823000002","SR242120230823000001","SR242120230823000002","SR242120230823000003","SR242120230823000004","SR242120230823000005","SR242120230823000006","SR242120230823000007","SR242120230823000008","SR242120230823000009","SR242120230823000010","SR242120230823000011","SR242120230823000012","SR242120230823000013","SR242120230823000014","SR242120230823000015","SR242120230823000016","SR242120230823000017","SR242120230823000018","SR242120230823000019","SR242120230823000020","SR242120230823000021","SR242120230823000022","SR242120230823000023","SR242120230823000024","SR242120230823000025","SR242120230823000026","SR242120230823000027","SR242120230823000028","SR242120230823000029","SR242120230823000030","SR242120230823000031","SR242120230823000032","SR242120230823000033","SR242120230823000034","SR242120230823000035","SR242120230823000036","SR242120230823000037","SR242120230823000038","SR242120230823000039","SR242120230823000040","SR242120230823000041","SR242120230823000042","SR242120230823000043","SR242120230823000044","SR242120230823000045","SR242120230823000046","SR242120230823000047","SR242120230823000048","SR242120230823000049","SR242120230823000050","SR242120230823000051","SR242120230823000052","SR242120230823000053","SR242120230823000054","SR242120230823000055","SR242120230823000056","SR242120230823000057","SR242120230823000058","SR242120230823000059","SR242120230823000060","SR242120230823000061","SR242120230823000062","SR242120230823000063","SR242120230823000064","SR242120230823000065","SR242120230823000066","SR242120230823000067","SR242120230823000068","SR242120230823000069","SR242120230823000070","SR242120230823000071","SR242120230823000072","SR242120230823000073","SR242120230823000074","SR242120230823000075","SR242120230823000076","SR242120230823000077","SR242120230823000078","SR242120230823000079","SR242120230823000080","SR242120230823000081","SR242120230823000082","SR242120230823000083","SR242120230823000084","SR242120230823000085","SR242120230823000086","SR242120230823000087","SR242120230823000088","SR242120230823000089","SR242120230823000090","SR242120230823000091","SR242120230823000092","SR242120230823000093","SR242120230823000094","SR242120230823000095","SR242120230823000096","SR242120230823000097","SR242120230823000098","SR242120230823000099","SR242120230823000100","SR242120230823000101","SR242120230823000102","SR242120230823000103","SR242120230823000104","SR242120230823000105","SR242120230823000106","SR242120230823000107","SR242120230823000108","SR242120230823000109","SR242120230823000110","SR242120230823000111","SR242120230823000112","SR242120230823000113","SR242120230823000114","SR242120230823000115","SR242120230823000116","SR242120230823000117","SR242120230823000118","SR242120230823000119","SR242120230823000120","SR242120230823000121","SR242120230823000122","SR242120230823000123","SR242120230823000124","SR242120230823000125","SR242120230823000126","SR242120230823000127","SR242120230823000128","SR242120230823000129","SR242120230823000130","SR242120230823000131","SR242120230823000132","SR242120230823000133","SR242120230823000134","SR242120230823000135","SR242120230823000136","SR242120230823000137","SR242120230823000138","SR242120230823000139","SR242120230823000140","SR242120230823000141","SR242120230823000142","SR242120230823000143","SR242120230823000144","SR242120230823000145","SR242120230823000146","SR242120230823000147","SR242120230823000148","SR242120230823000149","SR242120230823000150","SR242120230823000151","SR242120230823000152","SR242120230823000153","SR242120230823000154","SR242120230823000155","SR242120230823000156","SR242120230823000157","SR242120230823000158","SR242120230823000159","SR242120230823000160","SR242120230823000161","SR242120230823000162","SR242120230823000163","SR242120230823000164","SR242120230823000165","SR242120230823000166","SR242120230823000167","SR242120230823000168","SR242120230823000169","SR242120230823000170","SR242120230823000171","SR242120230823000172","SR242120230823000173","SR242120230823000174","SR242120230823000175","SR242120230823000176","SR242120230823000177","SR242120230823000178","SR242120230823000179","SR242120230823000180","SR242120230823000181","SR242120230823000182","SR242120230823000183","SR242120230823000184","SR242120230823000185","SR242120230823000186","SR242120230823000187","SR242120230823000188","SR242120230823000189","SR242120230823000190","SR242120230823000191","SR242120230823000192","SR242120230823000193","SR242120230823000194","SR242120230823000195","SR242120230823000196","SR242120230823000197","SR242120230823000198","SR242120230823000199","SR242120230823000200","SR242120230823000201","SR242120230823000202","SR242120230823000203","SR242120230823000204","SR242120230823000205","SR242120230823000206","SR242120230823000207","SR242120230823000208","SR242120230823000209","SR242120230823000210","SR242120230823000211","SR242120230823000212","SR242120230823000213","SR242120230823000214","SR242120230823000215","SR242120230823000216","SR242120230823000217","SR242120230823000218","SR242120230823000219","SR242120230823000220","SR242120230823000221","SR242120230823000222","SR242120230823000223","SR242120230823000224","SR242120230823000225","SR242120230823000226","SR242120230823000227","SR242120230823000228","SR242120230823000229","SR242120230823000230","SR242120230823000231","SR242120230823000232","SR242120230823000233","SR242120230823000234","SR242120230823000235","SR242120230823000236","SR242120230823000237","SR242120230823000238","SR242120230823000239","SR242120230823000240","SR242120230823000241","SR242120230823000242","SR242120230823000243","SR242120230823000244","SR242120230823000245","SR242120230823000246","SR242120230823000247","SR242120230823000248","SR242120230823000249","SR242120230823000250","SR242120230823000251","SR242120230823000252","SR242120230823000253","SR242120230823000254","SR242120230823000255","SR242120230823000256","SR242120230823000257","SR242120230823000258","SR242120230823000259","SR242120230823000260","SR242120230823000261","SR242120230823000262","SR242120230823000263","SR242120230823000264","SR242120230823000265","SR242120230823000266","SR242120230823000267","SR242120230823000268","SR242120230823000269","SR242120230823000270","SR242120230823000271","SR242120230823000272","SR242120230823000273","SR242120230823000274","SR242120230823000275","SR242120230823000276","SR242120230823000277","SR242120230823000278","SR242120230823000279","SR242120230823000280","SR242120230823000281","SR242120230823000282","SR242120230823000283","SR242120230823000284","SR242120230823000285","SR242120230823000286","SR242120230823000287","SR242120230823000288","SR242120230823000289","SR242120230823000290","SR242120230823000291","SR242120230823000292","SR242120230823000293","SR242120230823000294","SR242120230823000295","SR242120230823000296","SR242120230823000297","SR242120230823000298","SR242120230823000299","SR242120230823000300","SR242120230823000301","SR242120230823000302","SR242120230823000303","SR242120230823000304","SR242120230823000305","SR242120230823000306","SR242120230823000307","SR242120230823000308","SR242120230823000309","SR242120230823000310","SR242120230823000311","SR242120230823000312","SR242120230823000313","SR242120230823000314","SR242120230823000315","SR242120230823000316","SR242120230823000317","SR242120230823000318","SR242120230823000319","SR242120230823000320","SR242120230823000321","SR242120230823000322","SR242120230823000323","SR242120230823000324","SR242120230823000325","SR242120230823000326","SR242120230823000327","SR242120230823000328","SR242120230823000329","SR242120230823000330","SR242120230823000331","SR242120230823000332","SR242120230823000333","SR242120230823000334","SR242120230823000335","SR242120230823000336","SR242120230823000337","SR242120230823000338","SR242120230823000339","SR242120230823000340","SR242120230823000341","SR242120230823000342","SR242120230823000343","SR242120230823000344","SR242120230823000345","SR242120230823000346","SR242120230823000347","SR242120230823000348","SR242120230823000349","SR242120230823000350","SR242120230823000351","SR242120230823000352","SR242120230823000353","SR242120230823000354","SR242120230823000355","SR242120230823000356","SR242120230823000357","SR242120230823000358","SR242120230823000359","SR242120230823000360","SR242120230823000361","SR242120230823000362","SR242120230823000363","SR242120230823000364","SR242120230823000365","SR242120230823000366","SR242120230823000367","SR242120230823000368","SR242120230823000369","SR242120230823000370","SR242120230823000371","SR242120230823000372","SR242120230823000373","SR242120230823000374","SR242120230823000375","SR242120230823000376","SR242120230823000377","SR242120230823000378","SR242120230823000379","SR242120230823000380","SR242120230823000381","SR242120230823000382","SR242120230823000383","SR242120230823000384","SR242120230823000385","SR242120230823000386","SR242120230823000387","SR242120230823000388","SR242120230823000389","SR242120230823000390","SR242120230823000391","SR242120230823000392","SR242120230823000393","SR242120230823000394","SR242120230823000395","SR242120230823000396","SR242120230823000397","SR242120230823000398","SR242120230823000399","SR242120230823000400","SR242120230823000401","SR242120230823000402","SR242120230823000403","SR242120230823000404","SR242120230823000405","SR242120230823000406","SR242120230823000407","SR242120230823000408","SR242120230823000409","SR242120230823000410","SR242120230823000411","SR242120230823000412","SR242120230823000413","SR242120230823000414","SR242120230823000415","SR242120230823000416","SR242120230823000417","SR242120230823000418","SR242120230823000419","SR242120230823000420","SR242120230823000421","SR242120230823000422","SR242120230823000423","SR242120230823000424","SR242120230823000425","SR242120230823000426","SR242120230823000427","SR242120230823000428","SR242120230823000429","SR242120230823000430","SR242120230823000431","SR242120230823000432","SR242120230823000433","SR242120230823000434","SR242120230823000435","SR242120230823000436","SR242120230823000437","SR242120230823000438","SR242120230823000439","SR242120230823000440","SR242120230823000441","SR242120230823000442","SR242120230823000443","SR242120230823000444","SR242120230823000445","SR242120230823000446","SR242120230823000447","SR242120230823000448","SR242120230823000449","SR242120230823000450","SR242120230823000451","SR242120230823000452","SR242120230823000453","SR242120230823000454","SR242120230823000455","SR242120230823000456","SR242120230823000457","SR242120230823000458","SR242120230823000459","SR242120230823000460","SR242120230823000461","SR242120230823000462","SR242120230823000463","SR242120230823000464","SR242120230823000465","SR242120230823000466","SR242120230823000467","SR242120230823000468","SR242120230823000469","SR242120230823000470","SR242120230823000471","SR242120230823000472","SR242120230823000473","SR242120230823000474","SR242120230823000475","SR242120230823000476","SR242120230823000477","SR242120230823000478","SR242120230823000479","SR242120230823000480","SR242120230823000481","SR242120230823000482","SR242120230823000483","SR242120230823000484","SR242120230823000485","SR242120230823000486","SR242120230823000487","SR242120230823000488","SR242120230823000489","SR242120230823000490","SR242120230823000491","SR242120230823000492","SR242120230823000493","SR242120230823000494","SR242120230823000495","SR242120230823000496","SR242120230823000497","SR242120230823000498","SR242120230823000499","SR242120230823000500","SR242120230823000501","SR242120230823000502","SR242120230823000503","SR242120230823000504","SR242120230823000505","SR242120230823000506","SR242120230823000507","SR242120230823000508","SR242120230823000509","SR242120230823000510","SR242120230823000511","SR242120230823000512","SR242120230823000513","SR242120230823000514","SR242120230823000515","SR242120230823000516","SR242120230823000517","SR242120230823000518","SR242120230823000519","SR242120230823000520","SR242120230823000521","SR242120230823000522","SR242120230823000523","SR242120230823000524","SR242120230823000525","SR242120230823000526","SR242120230823000527","SR242120230823000528","SR242120230823000529","SR242120230823000530","SR242120230823000531","SR242120230823000532","SR242120230823000533","SR242120230823000534","SR242120230823000535","SR242120230823000536","SR242120230823000537","SR242120230823000538","SR242120230823000539","SR242120230823000540","SR242120230823000541","SR242120230823000542","SR242120230823000543","SR242120230823000544","SR242120230823000545","SR242120230823000546","SR242120230823000547","SR242120230823000548","SR242120230823000549","SR242120230823000550","SR242120230823000551","SR242120230823000552","SR242120230823000553","SR242120230823000554","SR242120230823000555","SR242120230823000556","SR242120230823000557","SR242120230823000558","SR242120230823000559","SR242120230823000560","SR242120230823000561","SR242120230823000562","SR242120230823000563","SR242120230823000564","SR242120230823000565","SR242120230823000566","SR242120230823000567","SR242120230823000568","SR242120230823000569","SR242120230823000570","SR242120230823000571","SR242120230823000572","SR242120230823000573","SR242120230823000574","SR242120230823000575","SR242120230823000576","SR242120230823000577","SR242120230823000578","SR242120230823000579","SR242120230823000580","SR242120230823000581","SR242120230823000582","SR242120230823000583","SR242120230823000584","SR242120230823000585","SR242120230823000586","SR242120230823000587","SR242120230823000588","SR242120230823000589","SR242120230823000590","SR242120230823000591","SR242120230823000592","SR242120230823000593","SR242120230823000594","SR242120230823000595","SR242120230823000596","SR242120230823000597","SR242120230823000598","SR242120230823000599","SR242120230823000600","SR242120230823000601","SR242120230823000602","SR242120230823000603","SR242120230823000604","SR242120230823000605","SR242120230823000606","SR242120230823000607","SR242120230823000608","SR242120230823000609","SR242120230823000610","SR242120230823000611","SR242120230823000612","SR242120230823000613","SR242120230823000614","SR242120230823000615","SR242120230823000616","SR242120230823000617","SR242120230823000618","SR242120230823000619","SR242120230823000620","SR242120230823000621","SR242120230823000622","SR242120230823000623","SR242120230823000624","SR242120230823000625","SR242120230823000626","SR242120230823000627","SR242120230823000628","SR242120230823000629","SR242120230823000630","SR242120230823000631","SR242120230823000632","SR242120230823000633","SR242120230823000634","SR242120230823000635","SR242120230823000636","SR242120230823000637","SR242120230823000638","SR242120230823000639","SR242120230823000640","SR242120230823000641","SR242120230823000642","SR242120230823000643","SR242120230823000644","SR242120230823000645","SR242120230823000646","SR242120230823000647","SR242120230823000648","SR242120230823000649","SR242120230823000650","SR242120230823000651","SR242120230823000652","SR242120230823000653","SR242120230823000654","SR242120230823000655","SR242120230823000656","SR242120230823000657","SR242120230823000658","SR242120230823000659","SR242120230823000660","SR242120230823000661","SR242120230823000662","SR242120230823000663","SR242120230823000664","SR242120230823000665","SR242120230823000666","SR242120230823000667","SR242120230823000668","SR242120230823000669","SR242120230823000670","SR242120230823000671","SR242120230823000672","SR242120230823000673","SR242120230823000674","SR242120230823000675","SR242120230823000676","SR242120230823000677","SR242120230823000678","SR242120230823000679","SR242120230823000680","SR242120230823000681","SR242120230823000682","SR242120230823000683","SR242120230823000684","SR242120230823000685","SR242120230823000686","SR242120230823000687","SR242120230823000688","SR242120230823000689","SR242120230823000690","SR242120230823000691","SR242120230823000692","SR242120230823000693","SR242120230823000694","SR242120230823000695","SR242120230823000696","SR242120230823000697","SR242120230823000698","SR242120230823000699","SR242120230823000700","SR242120230823000701","SR242120230823000702","SR242120230823000703","SR242120230823000704","SR242120230823000705","SR242120230823000706","SR242120230823000707","SR242120230823000708","SR242120230823000709","SR242120230823000710","SR242120230823000711","SR242120230823000712","SR242120230823000713","SR242120230823000714","SR242120230823000715","SR242120230823000716","SR242120230823000717","SR242120230823000718","SR242120230823000719","SR242120230823000720","SR242120230823000721","SR242120230823000722","SR242120230823000723","SR242120230823000724","SR242120230823000725","SR242120230823000726","SR242120230823000727","SR242120230823000728","SR242120230823000729","SR242120230823000730","SR242120230823000731","SR242120230823000732","SR242120230823000733","SR242120230823000734","SR242120230823000735","SR242120230823000736","SR242120230823000737","SR242120230823000738","SR242120230823000739","SR242120230823000740","SR242120230823000741","SR242120230823000742","SR242120230823000743","SR242120230823000744","SR242120230823000745","SR242120230823000746","SR242120230823000747","SR242120230823000748","SR242120230823000749","SR242120230823000750","SR242120230823000751","SR242120230823000752","SR242120230823000753","SR242120230823000754","SR242120230823000755","SR242120230823000756","SR242120230823000757","SR242120230823000758","SR242120230823000759","SR242120230823000760","SR242120230823000761","SR242120230823000762","SR242120230823000763","SR242120230823000764","SR242120230823000765","SR242120230823000766","SR242120230823000767","SR242120230823000768","SR242120230823000769","SR242120230823000770","SR242120230823000771","SR242120230823000772","SR242120230823000773","SR242120230823000774","SR242120230823000775","SR242120230823000776","SR242120230823000777","SR242120230823000778","SR242120230823000779","SR242120230823000780","SR242120230823000781","SR242120230823000782","SR242120230823000783","SR242120230823000784","SR242120230823000785","SR242120230823000786","SR242120230823000787","SR242120230823000788","SR242120230823000789","SR242120230823000790","SR242120230823000791","SR242120230823000792","SR242120230823000793","SR242120230823000794","SR242120230823000795","SR242120230823000796","SR242120230823000797","SR242120230823000798","SR242120230823000799","SR242120230823000800","SR242120230823000801","SR242120230823000802","SR242120230823000803","SR242120230823000804","SR242120230823000805","SR242120230823000806","SR242120230823000807","SR242120230823000808","SR242120230823000809","SR242120230823000810","SR242120230823000811","SR242120230823000812","SR242120230823000813","SR242120230823000814","SR242120230823000815","SR242120230823000816","SR242120230823000817","SR242120230823000818","SR242120230823000819","SR242120230823000820","SR242120230823000821","SR242120230823000822","SR242120230823000823","SR242120230823000824","SR242120230823000825","SR242120230823000826","SR242120230823000827","SR242120230823000828","SR242120230823000829","SR242120230823000830","SR242120230823000831","SR242120230823000832","SR242120230823000833","SR242120230823000834","SR242120230823000835","SR242120230823000836","SR242120230823000837","SR242120230823000838","SR242120230823000839","SR242120230823000840","SR242120230823000841","SR242120230823000842","SR242120230823000843","SR242120230823000844","SR242120230823000845","SR242120230823000846","SR242120230823000847","SR242120230823000848","SR242120230823000849","SR242120230823000850","SR242120230823000851","SR242120230823000852","SR242120230823000853","SR242120230823000854","SR242120230823000855","SR242120230823000856","SR242120230823000857","SR242120230823000858","SR242120230823000859","SR242120230823000860","SR242120230823000861","SR242120230823000862","SR242120230823000863","SR242120230823000864","SR242120230823000865","SR242120230823000866","SR242120230823000867","SR242120230823000868","SR242120230823000869","SR242120230823000870","SR242120230823000871","SR242120230823000872","SR242120230823000873","SR242120230823000874","SR242120230823000875","SR242120230823000876","SR242120230823000877","SR242120230823000878","SR242120230823000879","SR242120230823000880","SR242120230823000881","SR242120230823000882","SR242120230823000883","SR242120230823000884","SR242120230823000885","SR242120230823000886","SR242120230823000887","SR242120230823000888","SR242120230823000889","SR242120230823000890","SR242120230823000891","SR242120230823000892","SR242120230823000893","SR242120230823000894","SR242120230823000895","SR242120230823000896","SR242120230823000897","SR242120230823000898","SR242120230823000899","SR242120230823000900","SR242120230823000901","SR242120230823000902","SR242120230823000903","SR242120230823000904","SR242120230823000905","SR242120230823000906","SR242120230823000907","SR242120230823000908","SR242120230823000909","SR242120230823000910","SR242120230823000911","SR242120230823000912","SR242120230823000913","SR242120230823000914","SR242120230823000915","SR242120230823000916","SR242120230823000917","SR242120230823000918","SR242120230823000919","SR242120230823000920","SR242120230823000921","SR242120230823000922","SR242120230823000923","SR242120230823000924","SR242120230823000925","SR242120230823000926","SR242120230823000927","SR242120230823000928","SR242120230823000929","SR242120230823000930","SR242120230823000931","SR242120230823000932","SR242120230823000933","SR242120230823000934","SR242120230823000935","SR242120230823000936","SR242120230823000937","SR242120230823000938","SR242120230823000939","SR242120230823000940","SR242120230823000941","SR242120230823000942","SR242120230823000943","SR242120230823000944","SR242120230823000945","SR242120230823000946","SR242120230823000947","SR242120230823000948","SR242120230823000949","SR242120230823000950","SR242120230823000951","SR242120230823000952","SR242120230823000953","SR242120230823000954","SR242120230823000955","SR242120230823000956","SR242120230823000957","SR242120230823000958","SR242120230823000959","SR242120230823000960","SR242120230823000961","SR242120230823000962","SR242120230823000963","SR242120230823000964","SR242120230823000965","SR242120230823000966","SR242120230823000967","SR242120230823000968","SR242120230823000969","SR242120230823000970","SR242120230823000971","SR242120230823000972","SR242120230823000973","SR242120230823000974","SR242120230823000975","SR242120230823000976","SR242120230823000977","SR242120230823000978","SR242120230823000979","SR242120230823000980","SR242120230823000981","SR242120230823000982","SR242120230823000983","SR242120230823000984","SR242120230823000985","SR242120230823000986","SR242120230823000987","SR242120230823000988","SR242120230823000989","SR242120230823000990","SR242120230823000991","SR242120230823000992","SR242120230823000993","SR242120230823000994","SR242120230823000995","SR242120230823000996","SR242120230823000997","SR242120230823000998","SR242120230823000999","SR242120230823001000","SR242120230823001001","SR242120230823001002","SR242120230823001003","SR242120230823001004","SR242120230823001005","SR242120230823001006","SR242120230823001007","SR242120230823001008","SR242120230823001009","SR242120230823001010","SR242120230823001011","SR242120230823001012","SR242120230823001013","SR242120230823001014","SR242120230823001015","SR242120230823001016","SR242120230823001017","SR242120230823001018","SR242120230823001019","SR242120230823001020","SR242120230823001021"};
////    	String[] arr = {"SR169020230822000002","SR169020230822000003","SR169020230823000001","SR173420230823000001","SR173420230823000002","SR222720230823000001","SR222720230823000002","SR222720230823000003","SR222720230823000004","SR222720230823000005","SR222720230823000006","SR222720230823000007","SR222720230823000008","SR222720230823000009","SR222720230823000010","SR222720230823000011","SR223620230823000001","SR223620230823000002","SR223620230823000003","SR223620230823000004","SR223620230823000005","SR223620230823000006","SR223620230823000007","SR223620230823000008","SR223620230823000009","SR223620230823000010","SR223620230823000011","SR223620230823000012","SR223620230823000013","SR223620230823000014","SR223620230823000015","SR223620230823000016","SR223620230823000017","SR223620230823000018","SR223620230823000019","SR223620230823000020","SR223620230823000021","SR223620230823000022","SR223620230823000023","SR223620230823000024","SR224820230823000001","SR264920230823000001","SR264920230823000002","SR264920230823000003","SR264920230823000004","SR264920230823000006","SR264920230823000008","SR264920230823000011","SR264920230823000012","SR264920230823000015","SR274220230823000023","SR275120230823000025"};
//    	for (int i = 0; i < arr.length; i++) {
//    		String urlStr = "https://yonsuite.diwork.com/mdf-node/uniform/bill/list?locale=zh_CN&serviceCode=marap0008&terminalType=1&extend=true";
//    		
//    		String jsonString = "{\"page\":{\"pageSize\":20,\"pageIndex\":1,\"totalCount\":1},\"billnum\":\"arap_oarlist\",\"condition\":{\"commonVOs\":[{\"itemName\":\"schemeName\",\"value1\":\"默认方案\"},{\"itemName\":\"isDefault\",\"value1\":true},{\"value1\":\""+arr[i]+"\",\"itemName\":\"code\"},{\"value1\":\"1\",\"itemName\":\"auditstatus\"}],\"filtersId\":\"1137552601\",\"solutionId\":1243059059,\"isExtend\":true,\"simpleVOs\":[{\"field\":\"initflag\",\"value1\":\"0\",\"op\":\"eq\"},{\"logicOp\":\"or\",\"conditions\":[{\"field\":\"synergystatus\",\"op\":\"eq\",\"value1\":\"1\"},{\"field\":\"synergystatus\",\"op\":\"is_null\",\"value1\":\"\"}]}]},\"bClick\":true,\"bEmptyWithoutFilterTree\":false,\"locale\":\"zh_CN\",\"serviceCode\":\"marap0008\",\"ownDomain\":\"fiarap\",\"tplid\":1050336,\"queryId\":1694603532911}";
//    		
//    		JSONArray sendPost = JSONObject.parseObject(sendPost(urlStr, jsonString)).getJSONObject("data").getJSONArray("recordList");
//    		if (sendPost.size()!=0) {
//    			JSONObject jsonObject = sendPost.getJSONObject(0);
//    			String string = jsonObject.getString("id");
//    			
//    			String urlStr2 = "https://yonsuite.diwork.com/mdf-node/uniform/voucher/getid?serviceCode=marap0008&terminalType=1&extend=true&locale=zh_CN";
//    			
//    			String string2 = "{\"id\":\""+string+"\",\"billnum\":\"arap_oar\"}";
//    			String voucherno = JSONObject.parseObject(sendPost(urlStr2, string2)).getJSONObject("data").getJSONArray("data").getJSONObject(0).getString("voucherno");
//    			hashSet.add(voucherno);
//    		}
//		}	
//    	System.out.println(JSONObject.toJSON(hashSet));
//	}
    
    
//    public static void main(String[] args) throws IOException {
//    	File file = new File("D:\\Program Files\\Desktop\\dev.txt");
//    	InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(new File("D:\\Program Files\\Desktop\\dev.txt")));
//    	BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
//    	
//    	StringBuffer stringBuffer = new StringBuffer();
//    	String lineString = "";
//    	while ((lineString=bufferedReader.readLine())!=null) {
//			stringBuffer.append(lineString);
//		}
//    	JSONArray parseArray = JSONArray.parseArray(stringBuffer.toString());
//    	for (int i = 0; i < parseArray.size(); i++) {
//    		JSONObject jsonObject = parseArray.getJSONObject(i);
//    		String year = jsonObject.getString("year");
//    		
//    		JSONArray childrens = jsonObject.getJSONArray("children");
//    		for (int j = 0; j < childrens.size(); j++) {
//				JSONObject jsonObject2 = childrens.getJSONObject(j);
//				String month = jsonObject2.getString("month");
//				JSONArray events = jsonObject2.getJSONArray("event");
//				for (int k = 0; k < events.size(); k++) {
//					String string = events.getString(k);
//					
//					String sqlString = "INSERT INTO developmenthistory(cyear,cmonth,cContent,pubts)VALUES('"+year+"','"+month+"','"+string+"',now());";
//					System.out.println(sqlString);
//				}
//				
//			}
//		}
//	}
    
//    public static void main(String[] args) {
//    	try {
//    		String filePathString = "D:\\Program Files\\Desktop\\orgInfo.json";
//    		JSONArray readFile = readFile(filePathString);
//    		for (int i = 0; i < readFile.size(); i++) {
//    			String orgid = readFile.getString(i);
//    			String filePathString1 = "D:\\Program Files\\Desktop\\productsku.json";
//        		JSONArray readFile1 = readFile(filePathString1);
//        		for (int j = 0; j < readFile1.size(); j++) {
//					JSONArray jsonArray = readFile1.getJSONArray(j);
//					String urlString = "https://yonbip-core3.diwork.com/mdf-node/uniform/bill/list?serviceCode=ECInventAllot02&locale=zh_CN&terminalType=1&extend=true";
//
//					String string = "{\"page\":{\"pageSize\":1000,\"pageIndex\":1},\"billnum\":\"ec_distributionExecutionUnAuto\",\"condition\":{\"commonVOs\":[{\"itemName\":\"schemeName\",\"value1\":\"默认方案\"},{\"itemName\":\"isDefault\",\"value1\":true},{\"value1\":[\"1800106359137501201\"],\"itemName\":\"warehouse_name\"},{\"value1\":[\"1800326983020707890\"],\"itemName\":\"product_sku_id\"},{\"value1\":100,\"itemName\":\"num_scale\"},{\"value1\":\"0\",\"itemName\":\"is_suit\"},{\"value1\":\"1\",\"itemName\":\"is_noStock\"}],\"filtersId\":\"1070097432\",\"solutionId\":\"1821732601803571206\"},\"bClick\":true,\"bEmptyWithoutFilterTree\":false,\"serviceCode\":\"ECInventAllot02\",\"locale\":\"zh_CN\",\"isDistinct\":true,\"ownDomain\":\"dst\",\"tplid\":3100360}";
//					JSONObject parseObject = JSONObject.parseObject(string);
//					
//			    	JSONArray commonVOs = parseObject.getJSONObject("condition").getJSONArray("commonVOs");
//			    	for (int k = 0; k < commonVOs.size(); k++) {
//			    		JSONObject jsonObject = commonVOs.getJSONObject(k);
//			    		if (jsonObject.getString("itemName").equals("product_sku_id")) {
//							jsonObject.put("value1", jsonArray);
//						}else if (jsonObject.getString("itemName").equals("warehouse_name")) {
//							jsonObject.put("value1", Arrays.asList(orgid));
//						}
//					}
//			    	List<String> list = new LinkedList<>();
//			    	JSONArray recordList = JSONObject.parseObject(HttpUtil.sendPost(urlString, parseObject.toJSONString())).getJSONObject("data").getJSONArray("recordList");
//	
//					for (int l = 0; l < recordList.size(); l++) {
//						JSONObject jsonObject = recordList.getJSONObject(l);
//						list.add("\""+jsonObject.getString("id")+"\"");
//						if (list.size()==100 || jsonObject.containsValue("1810673078220881967")) {
//							String urlString2 = "https://yonbip-core3.diwork.com/mdf-node/uniform/distribution/unAutoUpLoad?action=upload&billnum=ec_distributionExecutionUnAuto&serviceCode=ECInventAllot02&terminalType=1&extend=true&locale=zh_CN";
//							
//							String str = "{\"billnum\":\"ec_distributionExecutionUnAuto\",\"action\":\"upload\",\"data\":\"[\\\"1800186227447562247\\\",\\\"1800186227447562246\\\"]\"}";
//							JSONObject parseObject2 = JSONObject.parseObject(str);
//							parseObject2.put("data", list.toString());
//							String sendPost = HttpUtil.sendPost(urlString2, parseObject2.toJSONString());
//							System.out.println(sendPost);
//							list = new LinkedList<>();
//						}
//					}
//					
//				}
//			}
//		} catch (Exception e) {
//			// TODO: handle exception
//		}
//
//		
//	}
    
    
    
    public static JSONArray readFile(String filePathString) {
    	JSONArray parseArray = new JSONArray();
    	try {
//    		String filePathString = "D:\\Program Files\\Desktop\\productSku.json";
    		InputStream fileInputStream = new FileInputStream(new File(filePathString));
    		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(fileInputStream));
    		
    		StringBuffer stringBuffer = new StringBuffer();
    		String lineStringBuffer="";
    		while((lineStringBuffer=bufferedReader.readLine())!=null) {
    			stringBuffer.append(lineStringBuffer);
    		}
    		
    		parseArray = JSONArray.parseArray(stringBuffer.toString());
		} catch (Exception e) {
			// TODO: handle exception
		}
    	return parseArray;
    }
    
//    public static void main(String[] args) {
//    	
//    	String fileString = "D:\\Program Files\\Desktop\\rep.json";
//    	JSONArray readFile = readFile(fileString);
//    	for (int i = 0; i < readFile.size(); i++) {
//    		JSONObject jsonObject = readFile.getJSONObject(i);
//    		//获取
//    		String eventTypeCode = jsonObject.getString("eventTypeCode");
//    		String queueName = jsonObject.getString("queueName").replace("kafka-", "");
//    		
//    		String queryString = "https://bip-test.yyuap.com/iuap-apcom-migration/script/queryResult";
//    		
//    		String queryParam = "{\"itemKey\":\"0180_iuap_event_new_event_listener_new\",\"projectName\":\"SDOC\",\"queryInfoList\":[{\"paramName\":\"sourceId\",\"paramValue\":\"DST\"},{\"paramName\":\"eventTypeCode\",\"paramValue\":\""+eventTypeCode+"\"},{\"paramName\":\"nodeCode\",\"paramValue\":\""+queueName+"\"}],\"profile\":\"基准环境\",\"dbType\":\"MYSQL\"}";
//    		
//    		try {
//				String sendPost = HttpUtil.sendPost(queryString, queryParam);
//				System.out.println(sendPost);
//				JSONObject columnValueObject = JSONObject.parseObject(sendPost).getJSONObject("data").getJSONArray("list").getJSONObject(0);
//				if (columnValueObject!=null) {
//					JSONArray columnValueList = columnValueObject.getJSONArray("columnValueList");
//					if (!columnValueList.isEmpty()) {
//						String string = "https://bip-test.yyuap.com/iuap-apcom-migration/script/exportData";
//			    		
//			    		String paramString = "{\"itemKey\":\"0180_iuap_event_new_event_listener_new\",\"projectName\":\"SDOC\",\"queryInfoList\":[{\"paramName\":\"sourceId\",\"paramValue\":\"DST\"},{\"paramName\":\"eventTypeCode\",\"paramValue\":\""+eventTypeCode+"\"},{\"paramName\":\"nodeCode\",\"paramValue\":\""+queueName+"\"}],\"profile\":\"基准环境\",\"dbType\":\"MYSQL\"}";
//			    		
//			    		String pathString = "D:\\Program Files\\Desktop\\event\\listten\\"+new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date())+".zip";
//			    		
//			    		
//			    		try {
//			    			HttpUtil.sendFilePost(string, paramString, pathString);
//			    		} catch (IOException e) {
//			    			// TODO Auto-generated catch block
//			    			e.printStackTrace();
//			    		}
//					}
//				}
//			} catch (IOException e1) {
//				// TODO Auto-generated catch block
//				e1.printStackTrace();
//			}
//    		
//    		
//		}
    	
//		String string = "https://bip-test.yyuap.com/iuap-apcom-migration/script/exportData";
//		
//		String paramString = "{\"itemKey\":\"0180_iuap_event_eventype\",\"projectName\":\"SDOC\",\"queryInfoList\":[{\"paramName\":\"sourceId\",\"paramValue\":\"DST\"},{\"paramName\":\"eventTypeCode\",\"paramValue\":\"EC_ALL_ABANDON_MESSAGE\"}],\"profile\":\"基准环境\",\"dbType\":\"MYSQL\"}";
//		
//		String pathString = "D:\\Program Files\\Desktop\\event\\"+new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date())+".zip";
//		
//		try {
//			HttpUtil.sendFilePost(string, paramString, pathString);
//		} catch (IOException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
//	}
    
    
    public static void main(String[] args) {
		String string = "{a=1232}";
//		net.sf.json.JSONObject fromObject = net.sf.json.JSONObject.fromObject(string);
//		Map parseObject = JSON.parseObject(JSON.toJSONString(string),Map.class);
//		System.out.println(fromObject);
	}
}
